package com.byzk.p2p.front.session;

import com.byzk.p2p.admin.user.dto.User;

/**
 * 将session保存到ThreadLocal本地线程中
 * @author Administrator
 *
 */
public class UserSession {
	
	public static final ThreadLocal<Object> threadLocal = new ThreadLocal<Object>();
	
	public UserSession() {
	}
	/**
	 * 赋值
	 * @param user
	 */
	public static void set(User user){
		threadLocal.set(user);
	}
	/**
	 * 取值
	 * @return
	 */
	public static User get(){    
        return (User) threadLocal.get();    
    } 
	/**
	 * 移除
	 */
	public static void remove(){
		threadLocal.remove();
	}
}

